import types

from basic.module2 import print_test


class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def show(self):
        print('%s的年龄是%d' % (self.name, self.age))


class Student(Person):
    def __init__(self, name, age,gender):
        self.name = name
        self.age = age
        self.gender = gender

    def study(self, course):
        print('%s正在学习%s' % (self.name, course))

wind = Student('wind', 23,'男')
#wind.study('python')
#print(wind.name)

#print(type(wind.name))


#print(wind.show())

def add():
    print('add')

r = type(add) == types.FunctionType

r2 = isinstance(wind, Person)

#print(r2)

a = 1
b = 'hello'
c = 1.2
d = True
e = None
f = [1,2,2]
g = (1,2,3)
h = {'name':'wind'}

print(type(a))
print(type(b))
print(type(c))
print(type(d))
print(type(e))
print(type(f))
print(type(g))
print(type(h))
print(type(add))

print(isinstance(wind,Student))
print(dir(a))
print('ABd'.lower())

print(hasattr(wind,'sex'))

getattr(wind,'show')()


class Animal(object):
    __slots__ = ('name','age')

Dog = Animal()
Dog.name = 'tian'
Dog.age = 2
#Dog.height = 30



class Student2(object):
    @property
    def birth(self):
        return self._birth

    @birth.setter
    def birth(self, value):
        self._birth = value

    @property
    def age(self):
        return 2015 - self._birth

s = Student2()
s.birth = 2000
print(s.birth)
